﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AnnealingModel.Demo.Common.Algorithm
{
    internal class SelectMin : ISelect
    {
        public void Select(Random random, double t, ref double dx, ref double dy, ref double bestX, ref double bestY)
        {
            if (bestY > dy)
            {
                bestY = dy;
                bestX = dx;
            }
            else if (Math.Exp((bestY - dy) / t) > random.NextDouble())
            {
                bestY = dy;
                bestX = dx;
            }
        }
    }
}
